package api

import response.base.PageData
import response.base.Res
import response.topic.TopicInfo
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

/**
 * @author BX-Gin
 * @since 2024/6/6 下午2:43
 */
interface TopicApi {

    /**
     * 查询主题列表
     * @param queryType Int
     * @param categoryId Int
     * @param sortType Int
     * @return Call<Res<PageData<TopicInfo>>>
     */
    @GET("$PREFIX/list")
    fun getList(
        @Query("query_type") queryType: Int = 1,
        @Query("category_id") categoryId: Int = 1,
        @Query("sort_type") sortType: Int = 1,
    ): Call<Res<PageData<TopicInfo>>>

    /**
     * 点赞
     * @param id Int
     * @param id2 Int
     * @return Call<Res<Nothing>>
     */
    @GET("$PREFIX/like/{id}")
    fun getLike(@Path("id") id: Int): Call<Res<Nothing>>

    /**
     * 查询主题详情
     * @param id Int
     * @return Call<Res<Nothing>>
     */
    @GET("$PREFIX/{id}")
    fun getTopic(@Path("id") id: Int): Call<Res<TopicInfo>>

    /**
     * 分享
     * @param id Int
     * @return Call<Res<Nothing>>
     */
    @GET("$PREFIX/share/{id}")
    fun getShare(@Path("id") id: Int): Call<Res<Nothing>>

    companion object {
        const val PREFIX = "community/topic"
    }
}